package com.tjs.lucky.domain.activity.service.stateflow;

import com.tjs.lucky.common.ActivityState;
import com.tjs.lucky.common.Result;
import org.springframework.stereotype.Service;

/**
 * @Author: 田佳澍
 * @Description: 状态处理类
 * @DateTime: 2023/5/22 15:42
 **/
@Service
public class StateHandler extends StateConfig {

    /**
     * 活动提审
     *
     * @param activityId
     * @param currentStatus
     * @return
     */
    public Result arraignment(Long activityId, Enum<ActivityState> currentStatus) {
        return stateGroup.get(currentStatus).arraignment(activityId, currentStatus);
    }

    /**
     * 审核通过
     *
     * @param activityId
     * @param currentStatus
     * @return
     */
    public Result checkPass(Long activityId, Enum<ActivityState> currentStatus) {
        return stateGroup.get(currentStatus).checkPass(activityId, currentStatus);
    }

    /**
     * 审核不通过
     *
     * @param activityId
     * @param currentStatus
     * @return
     */
    public Result checkRefuse(Long activityId, Enum<ActivityState> currentStatus) {
        return stateGroup.get(currentStatus).checkRefuse(activityId, currentStatus);
    }

    /**
     * 撤销审核
     *
     * @param activityId
     * @param currentStatus
     * @return
     */
    public Result checkRevoke(Long activityId, Enum<ActivityState> currentStatus) {
        return stateGroup.get(currentStatus).checkRevoke(activityId, currentStatus);
    }

    /**
     * 活动关闭
     *
     * @param activityId
     * @param currentStatus
     * @return
     */
    public Result close(Long activityId, Enum<ActivityState> currentStatus) {
        return stateGroup.get(currentStatus).close(activityId, currentStatus);
    }

    /**
     * 活动开启
     *
     * @param activityId
     * @param currentStatus
     * @return
     */
    public Result open(Long activityId, Enum<ActivityState> currentStatus) {
        return stateGroup.get(currentStatus).open(activityId, currentStatus);
    }

    /**
     * 活动进行中
     *
     * @param activityId
     * @param currentStatus
     * @return
     */
    public Result doing(Long activityId, Enum<ActivityState> currentStatus) {
        return stateGroup.get(currentStatus).doing(activityId, currentStatus);
    }

}
